package 数据结构下

import scala.collection.mutable.ArrayBuffer

object Exercise03 {
  def main(args: Array[String]): Unit = {
    val sentence = "AAAAAAAAAAABBBBBBBBCCCCCCCCDDDDDDDDD"
    val buffer = new ArrayBuffer[Char]()
    sentence.foldLeft(buffer)(putArray)
    println(buffer)

    def putArray(arr: ArrayBuffer[Char], c: Char): ArrayBuffer[Char] = {
      arr.append(c)
      arr
    }
  }

}
